﻿using SqlSugar;
using System.ComponentModel.DataAnnotations;
using Framework.SqlSugarCore.Abstractions;
using Newtonsoft.Json;
using my.abp.Domain.Shared.Enums;

namespace my.abp.Domain.Shared.Entities
{
	/// <summary>
	/// 系统用户表
	/// </summary>
	[SugarTable("SysUser", "系统用户表")]
	public class SysUser : EntityBase
	{
		/// <summary>
		/// 账号
		/// </summary>
		[SugarColumn(ColumnDescription = "账号", Length = 32)]
		[Required, MaxLength(32)]
		public virtual string Account { get; set; }

		/// <summary>
		/// 密码
		/// </summary>
		[SugarColumn(ColumnDescription = "密码", Length = 512)]
		[MaxLength(512)]
		[System.Text.Json.Serialization.JsonIgnore]
		[JsonIgnore]
		public virtual string Password { get; set; }

		/// <summary>
		/// 姓名
		/// </summary>
		[SugarColumn(ColumnDescription = "姓名", Length = 32)]
		[MaxLength(32)]
		public virtual string Name { get; set; }

		/// <summary>
		/// 直属机构Id
		/// </summary>
		[SugarColumn(ColumnDescription = "直属机构Id")]
		public long OrgId { get; set; }

		/// <summary>
		/// 直属机构
		/// </summary>
		[Navigate(NavigateType.OneToOne, nameof(OrgId))]
		public SysOrg SysOrg { get; set; }

		/// <summary>
		/// 排序
		/// </summary>
		[SugarColumn(ColumnDescription = "排序")]
		public int OrderNo { get; set; } = 100;

		/// <summary>
		/// 状态
		/// </summary>
		[SugarColumn(ColumnDescription = "状态")]
		public StatusEnum Status { get; set; } = StatusEnum.Enable;

		/// <summary>
		/// 备注
		/// </summary>
		[SugarColumn(ColumnDescription = "备注", Length = 256)]
		[MaxLength(256)]
		public string? Remark { get; set; }
	}
}
